import redis

def check_replication_delay(master_host, master_port, master_password, slave_host, slave_port, slave_password):
    r_master = redis.Redis(host=master_host, port=master_port, password=master_password)
    r_slave = redis.Redis(host=slave_host, port=slave_port, password=slave_password)

    master_info = r_master.info('replication')
    slave_info = r_slave.info('replication')

    master_offset = master_info['master_repl_offset']
    slave_offset = slave_info['slave_repl_offset']

    replication_delay = int(master_offset) - int(slave_offset)
    print(replication_delay)
    return replication_delay

check_replication_delay('172.16.67.157',7712,'fjAskld.fj87623','172.16.66.168',7712,'fjAskld.fj87623')